<?php


namespace Xiaoguai\DesignPattern\DP003;


use Xiaoguai\DesignPattern\Main\Base\CacheInterface;

/**
 * 对装饰对象做代理
 * Class Decorator
 * @package Xiaoguai\DesignPattern\DP003
 */
abstract class Decorator implements CacheInterface
{
    private $cache;

    public function __construct(CacheInterface $cache)
    {
        $this->cache = $cache;
    }

    public function get(string $key)
    {
        return $this->cache->get($key);
    }

    public function getName(): string
    {
        return $this->cache->getName();
    }
}